<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>示例4</title>
    <style>
        .a{
            font-size: 10px;
        }
    </style>
    <script>

        const colors = ["red","green","blue"]
        let i = 0;

        function changeStyle(){
            const title = document.getElementById("title");
            title.style.color = colors[i]
            i++
            if(i == colors.length){
                i = 0
            }
        }

        function show(){
            const title = document.getElementById("title");
            console.log(title.style.color)
        }
    </script>
</head>
<body>
    <h1 id="title">ACCP</h1>
    <button onclick="changeStyle()">点击</button>
    <button onclick="show()">打印标题的颜色</button>
</body>
</html>